import re
# li = ['www.baidu.com', 'www.123edu.cn', 'www.taobao.con', 'www.we.n']
# for i in li:
#     m1 = re.match(".*(.com|.cn)$",i)
#     if m1:  # 有数据 匹配不到None
#         print(m1.group())
#     else:
#         print(f"不符合的{i}")


te = ['1233', '1564', '1897', '1227']
for i in te:
    m1 = re.match("\d*[^47]$",i)
    if m1:
        print(m1.group())
    else:
        print(f"不符合的{i}")